package forum.util;


import java.util.Calendar;
import java.util.GregorianCalendar;

import javax.faces.model.SelectItem;

public class CalendarValues {

	public CalendarValues() {
	}

	public SelectItem[] getDays() {
		SelectItem[] selectItems = new SelectItem[31];
		for (int i = 0; i < selectItems.length; i++) {
			int t = i+1;
			selectItems[i] = new SelectItem(  i < 9 ?  "0"+t  : t+"");
		}

		return selectItems;
	}

	public SelectItem[] getMonths() {
		SelectItem[] selectItems = new SelectItem[12];
		for (int i = 0; i < selectItems.length; i++) {
			int t = i+1;
			selectItems[i] = new SelectItem(  i < 9 ?  "0"+t  : t+"");
		}

		return selectItems;
	}
	
	public SelectItem[] getYears() {
		int currentYear = GregorianCalendar.getInstance().get(Calendar.YEAR)+1;
		SelectItem[] selectItems = new SelectItem[currentYear-1900];
		for (int i = 1900; i < selectItems.length+1900; i++) {
			selectItems[i-1900] = new SelectItem(i+"");
		}

		return selectItems;
	}


}
